package com.weirong.smartvault.backservice.entity_model;

import com.weirong.smartvault.common.tools.spring.context.SpringContextUtil;
import com.weirong.smartvault.dao.ForeignCurrencyTypeRepository;
import com.weirong.smartvault.entity.ForeignCurrencyDenomination;
import com.weirong.smartvault.entity.ForeignCurrencyType;

/**
 * 于2017/12/8由 KFEB4 创建 .
 */
public class ForeignCurrencyDenominationModel {
    ForeignCurrencyDenomination foreignCurrencyDenomination;
    ForeignCurrencyTypeRepository foreignCurrencyTypeRepository;
    public ForeignCurrencyDenominationModel(ForeignCurrencyDenomination foreignCurrencyDenomination){
        this.foreignCurrencyDenomination = foreignCurrencyDenomination;
        foreignCurrencyTypeRepository = SpringContextUtil.getBean(ForeignCurrencyTypeRepository.class);
    }
    public String  getDescription(){
        return foreignCurrencyDenomination.getDescription();
    }
    public String  getName(){
        return foreignCurrencyDenomination.getName();
    }
    public String  getTypeCode(){
        return foreignCurrencyDenomination.getTypeCode();
    }
    public Integer getValue(){
        return foreignCurrencyDenomination.getValue();
    }

    public String getTypeNmae(){
        String typeCode = foreignCurrencyDenomination.getTypeCode();
        ForeignCurrencyType foreignCurrencyType = foreignCurrencyTypeRepository.getByCode(typeCode);
        return  foreignCurrencyType.getName();
    }

    public Integer getId(){
        return foreignCurrencyDenomination.getId();
    }
}
